package heven.holt.wan.android.repository

import androidx.paging.Pager
import androidx.paging.PagingConfig
import heven.holt.wan.android.api.ApiWanCoinServer
import heven.holt.wan.android.paging.source.WanCoinPagingSource

class WanCoinRepository constructor(
    private val apiWanCoinServer: ApiWanCoinServer
) {
    companion object {
        private const val PAGE_SIZE = 20
    }

    /**
     * 获取积分排行榜
     */
    fun getCoinRankListFlow() = Pager(
        config = PagingConfig(
            initialLoadSize = 10,
            prefetchDistance = 5,
            enablePlaceholders = false,
            pageSize = PAGE_SIZE
        )
    ) {
        WanCoinPagingSource(apiWanCoinServer)
    }.flow
}